<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <script type="text/javascript" src="/static/lib/jquery/1.9.1/jquery.min.js"></script>
</head>
<body>

<div class="page-container" id="main" style="width: 95%;height:580px;"></div>

<script type="text/javascript" src="/static/lib/echarts/echarts.js"></script>

<script type="text/javascript">

    // 基于准备好的dom，初始化echarts实例
    var myChart = echarts.init(document.getElementById('main'));

    $.ajax({
        type: "GET",
        url: "/charts/getPosiData",
        dataType: 'json',
        success: function(data){

            // 指定图表的配置项和数据
            option = {
                title : {
                    text: '单车区域分布',
                    subtext: '北京地区',
                    x:'center'
                },
                tooltip : {
                    trigger: 'item',
                    formatter: "{a} <br/>{b} : {c} ({d}%)"
                },
                legend: {
                    orient: 'vertical',
                    left: 'left',
                    data: data.names
                },
                series : [
                    {
                        name: '车辆分布',
                        type: 'pie',
                        radius : '55%',
                        center: ['50%', '60%'],
                        data: data.valueNames,
                        itemStyle: {
                            emphasis: {
                                shadowBlur: 10,
                                shadowOffsetX: 0,
                                shadowColor: 'rgba(0, 0, 0, 0.5)'
                            }
                        }
                    }
                ]
            };
            // 使用刚指定的配置项和数据显示图表。
            myChart.setOption(option);
        }
    });

    /**


    */
</script>

</body>
</html>